package com.example.service.impl;


import com.example.entity.DetailsLogs;
import com.example.mapper.DetailsLogsMapper;
import com.example.service.DetailsLogsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
 * <p>
 * 操作日志 服务实现类
 * </p>
 *
 * @author 
 * @since 2022-11-11
 */
@Service
public class DetailsLogsServiceImpl implements DetailsLogsService {

    @Autowired
    DetailsLogsMapper detailsLogsMapper;

    @Override
    public void insertLog(DetailsLogs detailsLogs) {
        detailsLogs.setCreateTime(new Date());
        detailsLogs.setOperateStatus(0);
        detailsLogs.setOperateDetails("添加");
        int i = detailsLogsMapper.insertLog(detailsLogs);
        if (i!=0){

        }else{
            detailsLogs.setOperateStatus(1);
            detailsLogsMapper.insertLog(detailsLogs);

        }
    }

    @Override
    public void updateLog(DetailsLogs detailsLogs) {
        detailsLogs.setCreateTime(new Date());
        detailsLogs.setOperateStatus(0);
        detailsLogs.setOperateDetails("修改");
        int i = detailsLogsMapper.insertLog(detailsLogs);
        if (i!=0){
        }else{
            detailsLogs.setOperateStatus(1);
            detailsLogsMapper.insertLog(detailsLogs);
        }
    }

    @Override
    public void deleteLog(DetailsLogs detailsLogs) {
        detailsLogs.setCreateTime(new Date());
        detailsLogs.setOperateStatus(0);
        detailsLogs.setOperateDetails("删除");
        int i = detailsLogsMapper.insertLog(detailsLogs);
        if (i!=0){
        }else{
            detailsLogs.setOperateStatus(1);
            detailsLogsMapper.insertLog(detailsLogs);
        }
    }
}
